home *** CD-ROM | disk | FTP | other *** search
/ PsL Monthly 1993 December / PSL Monthly Shareware CD-ROM (December 1993).iso / prgmming / dos / c / xnas.exe / XNAS.DOC < prev    next >
Text File  |  1992-01-19  |  7KB  |  192 lines

  1.  
  2.  
  3.         X N A S  Version 2.13
  4.  
  5.  
  6. Introduction
  7. ------------
  8.  
  9. The development of XNAS was inspired by working on the development of 
  10. several C-language based tools. The history is somewhat lengthy, but 
  11. basically the desire to see the logic of a module at a glance was the 
  12. driving force of the development of XNAS.
  13.  
  14. As opposed to common C source beautifiers, XNAS does NOT generate compiler 
  15. processable C code from the original source code. Instead, it produces a 
  16. structogramme from your C source module, which allows you to easily inspect 
  17. the logic of the module. This is done by drawing the structure of the 
  18. module in such a way that "blocks" which are on the same level of hirarchy 
  19. appear horizontally adjacent in the output file (e.g. the ELSE branch of an 
  20. IF statement will always be on the right side of and the same hight as the 
  21. THEN branch).
  22.  
  23. This technique has the disadvantage that the output of a heavily nested 
  24. source module can become very wide, which will force you to tape together 
  25. several pages of the output listing. However, command line parameters allow 
  26. you to adjust the width of blocks in order to trim the output to your 
  27. needs.
  28.  
  29. Example:
  30.  
  31. The source code
  32.  
  33.     while (!done) {
  34.         makeoutname(fcount);
  35.         if ((FILE *)NULL == (fo = fopen(outname, "w"))) {
  36.             printf("%s: cannot open\n", outname);
  37.             exit(2);
  38.         }
  39.         if (0 != setvbuf(fo, outbuf, _IOFBF, sizeof(outbuf))) {
  40.             printf("cannot set output buffer\n");
  41.             exit(4);
  42.         }
  43.         lcount = 0;
  44.         while (lcount++ < linecount) {
  45.             if ((char *)NULL == fgets(linebuff, LINE_SIZE, fi)) {
  46.                 done++;
  47.                 break;
  48.             }
  49.             if (EOF == fputs(linebuff, fo)) {
  50.                 printf("%s: write error\n", outname);
  51.                 exit(3);
  52.             }
  53.         }
  54.         fclose(fo);
  55.         fcount++;
  56.     }
  57.  
  58. will produce the following output file:
  59.  
  60.   +-------------------------------------------------------------------------+ 
  61.   | while  (!done)                                                          | 
  62.   |  +----------------------------------------------------------------------+ 
  63.   |  | makeoutname(fcount);                                                 | 
  64.   |  +----------------------------------------------------------------------+ 
  65.   |  | if  ((FILE *)NULL == (fo = fopen(outname, "w")))                     | 
  66.   |  +-T--------------------------------------------+-F---------------------+ 
  67.   |  | printf("%s: cannot open\n", outname);        |                       | 
  68.   |  | exit(2);                                     |                       | 
  69.   |  +----------------------------------------------+-----------------------+ 
  70.   |  | if  (0 != setvbuf(fo, outbuf, _IOFBF, sizeof(outbuf)))               | 
  71.   |  +-T--------------------------------------------+-F---------------------+ 
  72.   |  | printf("cannot set output buffer\n");        |                       | 
  73.   |  | exit(4);                                     |                       | 
  74.   |  +----------------------------------------------+-----------------------+ 
  75.   |  | lcount = 0;                                                          | 
  76.   |  +----------------------------------------------------------------------+ 
  77.   |  | while  (lcount++ < linecount)                                        | 
  78.   |  |  +-------------------------------------------------------------------+ 
  79.   |  |  | if  ((char *)NULL == fgets(linebuff, LINE_SIZE, fi))              | 
  80.   |  |  +-T------------------------------------------+-F--------------------+ 
  81.   |  |  | done++;                                    |                      | 
  82.   |  |  | break;                                     |                      | 
  83.   |  |  +--------------------------------------------+----------------------+ 
  84.   |  |  | if  (EOF == fputs(linebuff, fo))                                  | 
  85.   |  |  +-T------------------------------------------+-F--------------------+ 
  86.   |  |  | printf("%s: write error\n", outname);      |                      | 
  87.   |  |  | exit(3);                                   |                      | 
  88.   |  +--+--------------------------------------------+----------------------+ 
  89.   |  | fclose(fo);                                                          | 
  90.   |  | fcount++;                                                            | 
  91.   +--+----------------------------------------------------------------------+ 
  92.  
  93.  
  94.  
  95.  
  96. Command Syntax
  97. --------------
  98.  
  99.  
  100. XNAS sourcefile [options]
  101.  
  102.  
  103. sourcefile =    filename of your C source file (if not in current directory, 
  104.         do not forget to include the proper path name)
  105.  
  106. Options are:
  107.  
  108. -b<blocksize> = minimum width (in columns) of a block in the output 
  109.         file, default is 8. Range: 6<blocksize<100.
  110.  
  111. -e<emptysize> = width (in columns) of an empty block, default is
  112.         Range: 2<emptysize<100.
  113.  
  114. -er<emptysize>= minimum width of an empty block, default is 4.
  115.         Range: 2<emptysize<100.
  116.  
  117. -k            = do not strip spaces (global)
  118.  
  119. -kc           = do not strip spaces in comments
  120.  
  121. -ks           = do not strip spaces in strings
  122.  
  123. -p<linesize>  = page width (in columns), default is 162. Should be set 
  124.         to 80 for screen output.
  125.         Range: 10<linesize<1000.
  126.  
  127. -v            = quiet mode; switches off start and end message.
  128.  
  129. -x            = switches off the generation of printer control 
  130.         characters. Printer control characters are generated 
  131.         for EPSON compatible printers.
  132.  
  133. The output will always be written to file. The file name is same as the
  134. source file name except that the .C extension is replaced by .NAS .
  135.  
  136.  
  137.  
  138. HISTORY
  139. -------
  140.  
  141. Version 2.13    First public release (no joke, there actually where 
  142.         many versions before this one).
  143.  
  144.  
  145. LICENSING POLICY
  146. ----------------   
  147.  
  148. XNAS and its associated documentation are copyright (c) 1991 Walter Sorger, 
  149. all rights reserved. The XNAS software may not be circulated in any 
  150. incomplete or modified form, nor sold for profit, without written 
  151. permission of the author.
  152.  
  153. You may use this version (2.13) of XNAS without paying a licensing fee, 
  154. however, the author reserves the right to provide further versions of XNAS 
  155. on the normal shareware basis, i.e. charging a license fee.
  156.  
  157. If you like this little tool or if you have any comments or suggestions for 
  158. improvements, please write to the author:
  159.  
  160.     Walter Sorger
  161.     Seebenseestr. 28
  162.     8000 Muenchen 70
  163.     Germany
  164.  
  165.  
  166. DISTRIBUTION POLICY
  167. -------------------
  168.  
  169. XNAS may be distributed freely. If you distribute this software to others, 
  170. you are required to distribute the ENTIRE package consisting of the 
  171. following files:
  172.  
  173. XNAS.EXE
  174. XNAS.DOC
  175. README.1ST
  176.  
  177.  
  178. DISCLAIMER
  179. ----------
  180.  
  181. This software  is provided on an "as is" basis without warranty of any 
  182. kind, expressed or implied, including but not limited to the implied 
  183. warranties of merchantability and fitness for a particular purpose.  The 
  184. person using the software bears all risk as to the quality and performance 
  185. of the software.  The author will not be liable for any special, 
  186. incidental, consequential, indirect or similar damages due to loss of data 
  187. or any other reason, even if the author or an agent of the author has been 
  188. advised of the possibility of such damages.  In no event shall the author's 
  189. liability for any damages ever exceed the price paid for the license to use 
  190. the software, regardless of the form of the claim.
  191.  
  192.